package code.c03;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/9/15 11:24
 * @package code.c03
 * @description 文件说明
 */

public class Rectangle {
    private int length;

    private int width;

    public Rectangle() {

    }

    public Rectangle(int length, int width) {
        this.length = length;
        this.width = width;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getArea(){
        return width * length;
    }

    public int getPerimeter(){
        return (width + length)*2;
    }


    public String printInfo() {
        return "Rectangle{" +
                "length=" + length +
                ", width=" + width +
                ", area=" + getArea() +
                ", perimeter=" + getPerimeter() +
                '}';
    }

    public static void main(String[] args) {
        Rectangle rectangle = new Rectangle(3, 4);
        System.out.println(rectangle.getArea());
        System.out.println(rectangle.getPerimeter());

        System.out.println(rectangle.printInfo());
    }
}
